package org.example.controller;

import lombok.extern.slf4j.Slf4j;
import org.example.bean.ProductBean;
import org.example.bean.UserEntity;
import org.example.service.ProductService;
import org.example.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Semaphore;

@RestController
@RequestMapping("/user")
@RefreshScope
@Slf4j
public class UserController {
    @Autowired
    private UserService userService;
    @Value("${test.val}")
    private String val;

    @GetMapping("/batchInsert")
    public Map batchInsert(UserEntity userEntity) {
        Map<String,Object> map = new HashMap<>();
        userService.batchInsert(userEntity);
        return map;
    }

    @GetMapping("/getVal")
    public Map getVal(){
        Map<String,Object> map = new HashMap<>();
        map.put("val", val);
        log.info("getVal...............");
        return map;
    }
}
